<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	template="../../layout/template.xhtml">

	<ui:define name="body">
		<h:form id="form" styleClass="form-horizontal" prependId="false">
			<fieldset>
				<legend>Listar
					Aeronave</legend>
				<s:decorate template="../../layout/controls.xhtml">
					<s:div style="float:right">
						<h:commandButton action="manterAeronave" value="Nova Aeronave" styleClass="btn btn-primary" />
					</s:div>
				</s:decorate>
				<rich:dataTable id="datatableAeronave" value="#{colecaoAeronave}"
					var="aero" styleClass="table table-hover"
					rows="#{manterAeronaveAction.quantidadePorPagina}">
					<rich:column sortBy="#{aero.nomeAeronave}"
						filterBy="#{aero.nomeAeronave}" filterEvent="onkeyup">
						<f:facet name="header">
							<h:outputText value="#{label['label.nome.aeronave']}" />
						</f:facet>
						<h:outputText value="#{aero.nomeAeronave}" />
					</rich:column>
					<rich:column sortBy="#{aero.status.valor}"
						filterBy="#{aero.status.valor}" filterEvent="onkeyup">
						<f:facet name="header">
							<h:outputText value="#{label['label.status.aeronave.full']}" />
						</f:facet>
						<h:outputText value="#{aero.status.valor}" />
					</rich:column>
					<rich:column>
						<f:facet name="header">
							<h:outputText value="#{label['label.acoes']}" />
						</f:facet>
						<h:commandButton styleClass="btn btn-primary"
							action="#{manterAeronaveAction.selecionarAeronave(aero)}"
							value="Alterar" />
						<h:commandButton styleClass="btn btn-danger"
							onclick="if(!confirm('Deseja realmente excluir?')){return false;}"
							action="#{manterAeronaveAction.excluirAeronave(aero)}"
							value="Excluir" />
					</rich:column>
				</rich:dataTable>
				<center>
					<rich:datascroller id="scroller" for="datatableAeronave"
						renderIfSinglePage="false" />
				</center>
				<div style="float: left">
					<p>Total de registros: #{colecaoAeronave.size()}</p>
				</div>
				<div style="float: right">
					<p>
						Registro p/ Página:
						<h:selectOneMenu id="registroPorPagina"
							value="#{manterAeronaveAction.quantidadePorPagina}"
							style="margin-top:2px;margin-left:3px">
							<f:selectItem itemLabel="5" itemValue="5"
								noSelectionOption="true" />
							<f:selectItem itemLabel="10" itemValue="10" />
							<f:selectItem itemLabel="15" itemValue="15" />
							<f:selectItem itemLabel="20" itemValue="20" />
							<f:selectItem itemLabel="50" itemValue="50" />
							<a4j:support event="onchange"
								reRender="scroller,registroPorPagina,datatableAeronave"
								ajaxSingle="true" />
						</h:selectOneMenu>
					</p>
				</div>
			</fieldset>
		</h:form>
	</ui:define>
</ui:composition>
